home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Shareware World / Utilities / Text Processing / Jedit3.0 / Manual / Script Manual < prev   
Encoding:
Text File  |  1999-08-03  |  48.1 KB  |  1,670 lines  |  [TEXT/JED3]

  1. July 1999 Matsumoto & Co., Ltd.
  2.  
  3.  
  4.  
  5.   Jedit3.0 Script Manual
  6.  
  7.   <--- If you double click on this icon, the bookmark file "Script Index" will be opened.
  8.  
  9.  
  10.  
  11. Introduction
  12.  
  13. As Jedit3.0 is the AppleScript scriptable* application, you can control Jedit3.0  from the AppleScript program you made with the "Script Editor."  You can also register your script programs in the "Macro" menu of Jedit3.0 as your own custom menu. You can also control other AppleScript scriptable applications from a macro menu item you made.
  14. (For details of the "Macro" menu, see "Chapter 8, 8-1 Macro Menu".)
  15.  
  16. Using AppleScript commands supported by Jedit, you can launch/quit Jedit,  open/close/save documents of Jedit, edit text of them and so on.
  17.  
  18. The purpose of this chapter is mainly to explain the specifications of Jedit's AppleScript, not AppleScript in general. If you are not familiar with the fundamentals of AppleScript, please see some guide book.  You can also get useful information from the following web sites.
  19.  
  20. http://www.apple.com/applescript/   (in English)
  21. http://www.asep.apple.co.jp/Techdoc/AppleScript/  (in Japanese)
  22.  
  23. *  You can execute most of operations that are concerned with text editing by using Jedit's commands of AppleScript but there are some operations that cannot be controlled by AppleScript.  And Jedit is not an AppleScript recordable application as far as text editing is concerned.
  24.  
  25.  
  26.  
  27. Compatibility with Jedit2.0
  28.  
  29. The former version, Jedit2.0 also supports AppleScript. In most cases you can use your scripts of Jedit2.O also with Jedit3.0 if you change the application name in the "tell" statement that includes "Jedit2.0" as shown below.
  30.  
  31.         tell application "Jedit2"   ---> tell application "Jedit3"    
  32.  
  33. Please note the following differences between Jedit2.0 and Jedit3.0 concerning AppleScript .Å@
  34.  
  35. 1) Jedit2.0 supports both Japanese and English dialect in AppleScript.  But the AppleScript of MacOS8.5 or higher does not support Japanese dialect.  So Jedit3.0 supports only those commands written with Japanese dialect which Jedit2.0 supported, but new commands of Jedit3.0 cannot be written with Japanese dialect.  We recommend that you write your new scripts only with  English dialect.
  36.  
  37. 2) As Jedit3.0 is the multi-styled text editor, you can use new properties of font, size, style and color of each object such as byte, character, word, line, paragraph and selection. You can deal with the contents of these properties by means of "get" and "set" commands. The information you get from the properties of some object by the use of "get" command will be the style information of the first character of that object.
  38. While the style properties of the document object of Jedit2.0 are those of the whole document,these properties of Jedit3.0 are the default styles of the document.
  39. When you use commands such as "copy", "paste", "cut", "move" and "insert", you can also deal with the style data in addition to the text data.
  40.  
  41. 3) While the values of the properties defined in the macro scripts of Jedit2.0 will be always initialized when they are executed, these values of Jedit3.0 will be saved and  used in the next execution.
  42.  
  43. 4) The application object of Jedit3.0 has the"version" property. You can know your Jedit's version from the contents of this property.
  44.  
  45. 5) You can do "Find All" of the menu "Search" also from AppleScript by the use of the parameter "batch" of the "find" command of Jedit3.0.
  46.  
  47. 6) The specification of "as" parameter of "save" command is changed. If you have the script you made with Jedit2.0 and use it with Jedit3.0 , please take account of this change.
  48.  
  49. 7) Jedit3.0. has the following new commands too. 
  50.    "mark", "toHankaku", "toZenkaku", "toYomi", "speak", "updateMacroMenu"
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Objects (Classes)
  59.  
  60. The so-called "object(class)"s of Jedit3.0 you can control with AppleScript are "application", "window", "document", "byte", "character", "word", "line", "paragraph" and "selection".
  61.  
  62.  
  63.  
  64. "application" object
  65.  
  66. Commands Available:
  67.      run, launch, quit, get, set, exists, preDialog, postDialog, suspend, 
  68.      OpenURL, OpenDict, select, updateMacroMenu 
  69.  
  70. Properties:
  71.     kanji alarm  boolean 
  72.         If true, the alert dialog box of kanji/line break will be displayed at
  73.         opening the documents.
  74.     binary read  boolean  
  75.         If true, the alert dialog box of of binary file will not be displayed at
  76.         opening the documents.
  77.     cisjis judging  boolean  
  78.         If true, Jedit will judge the cis-kanji encoding at opening the
  79.         documents.
  80.     Jedit folder  file specification  [r/o] 
  81.         The file specification (file path) of the folder where Jedit3.0
  82.         program is.
  83.     macro folder  file specification  [r/o]
  84.         The file specification of the  Jedit3.0 macro items folder
  85.     version  integer  [r/o]  
  86.         The version of your Jedit3.0
  87.     infinite undo  boolean
  88.         If true, the infinite (multiple) undo is on.
  89.     resource save  create/neglect/dialog
  90.         Specifies the way to deal with resource fork when saving a file
  91.         without resource fork.
  92.     horizontal margin  integer
  93.         The left and right margin (mm) when printing a target file.
  94.     vertical margin  integer
  95.         The upper and lower margin  (mm) when printing a target file.
  96.     number printing  No/lineNum/paraNum/same as window
  97.         Specifies the way to print line/paragraph numbers.
  98.  
  99.  
  100.  
  101. "window" object
  102.  
  103. Commands Available: 
  104.     open, close, count, delete, exists, get, make, move, select, set
  105.     
  106. Properties:
  107.     bounds  bounding rectangle  
  108.         The  rectangular coordinates of the window.
  109.     closeable  boolean  [r/o]  
  110.         Does the window have a close box?
  111.     titled  boolean  [r/o]  
  112.         Does the window have a title bar?
  113.     index  integer  
  114.         The number of the window
  115.     floating  boolean  [r/o]  
  116.         Does the window float?
  117.     modal  boolean  [r/o]  
  118.          Is the window modal?
  119.     resizable  boolean  [r/o]  
  120.         Is the window resizable?
  121.     zoomable  boolean  [r/o]  
  122.         Is the window zoomable?
  123.     zoomed  boolean  
  124.         Is the window zoomed?
  125.     name  international text  
  126.         The title of the window
  127.     visible  boolean  [r/o]  
  128.         is the window visible?
  129.     position  point  [r/o]  
  130.         The upper left coordinates of the window
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. "document" object
  139.  
  140. Commands Available: 
  141.     make, open, close, print, save, revert, close, data size,  get, set,
  142.     insert, find, replace, mark, exist, cut, copy, paste, select,
  143.     undo, redo, speak, justify, remove break. detab, entab, toYomi,
  144.     toZenkaku, toHankaku, toUnicode, fromUnicode, OpenURL,
  145.     OpenChecker, OpenDict, preDialog, postDialog, suspend
  146.  
  147.  
  148. Properties:
  149.     name  international text  [r/o]  
  150.          The title of the document
  151.     modified  boolean  [r/o]  
  152.          Has the document been modified since last saved?
  153.     specified  boolean  [r/o]  
  154.           Has the document a file specification?
  155.     fileSpec  file specification  [r/o]  
  156.          The file specification of the document
  157.     font  international text  
  158.          The name of the default font
  159.     printing font international text  
  160.          The name of the default font used for the printing
  161.     fontSize  small integer  
  162.          The default font size
  163.     printing fontSize  small integer  
  164.         The font size for the printing.
  165.     style  text style info  
  166.          The default text style
  167.     fore color  'RGB '  
  168.          The default foreground (character) color of the document.
  169.     back color  'RGB '  
  170.          The background color of the document
  171.     auto indent  boolean  
  172.          If true, the auto indent is on.
  173.     tab width  small integer  
  174.          The tab width of the document (points)
  175.     word wrap  small integer  
  176.          0: word-wrap is off
  177.          1: normal word-wrap
  178.          2: hanging word-wrap in the Japanese text
  179.     line width  small integer  
  180.          The line width (points).  If zero, it follows the window width
  181.     line space  small integer  
  182.         The space between lines of the edit window (points)
  183.     kanji type  ShiftJis/Jis/Euc/NecJis/AcosJis/CisJis/Unicode/Utf8 
  184.         The type of encoding. 
  185.     lf type  mac/unix/dos
  186.         The type of line break.
  187.     html coloring  boolean  
  188.         If true, the HTML coloring is on.
  189.     infinite undo  boolean  
  190.          If true, the multiple undo is on.
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198. "byte" object
  199.  
  200. A "byte" object is a object whose length or position is expressed by byte. In English text, the byte object and the character object are same, but in the languages of 2-bytes characters such as Japanese, the byte object and the character object are not exactly the same object.  The 2-bytes character such as kanji is counted as one character.
  201.  
  202. Commands Available: 
  203.     print,  data size,  get, set, insert, find, replace, mark, exist, cut, 
  204.     copy,  select, speak, justify, remove break. detab, entab, toYomi, 
  205.     toZenkaku, toHankaku, toUnicode, fromUnicode
  206.  
  207. Properties:
  208.     length  integer  [r/o]  
  209.         The length of a byte object (in bytes)
  210.     byteoffset  integer  [r/o] 
  211.          The offset of a byte object from the beginning of the document 
  212.          (the first byte has offset 1)
  213.     line number  integer  [r/o]  
  214.         The line number of a byte object from the beginning of the document
  215.          (the first line has number 1)
  216.     paragraph number  integer  [r/o]  
  217.         The Paragraph number of a byte object from the beginning of the
  218.          document (the first paragraph has number 1)
  219.     font  international text  
  220.         The font name
  221.     fontSize  small integer  
  222.         The font size
  223.     style  text style info  
  224.         The text style 
  225.     fore color  'RGB ' 
  226.         The foreground (character) color
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233. "character" object
  234.  
  235. A "character" object represents one letter.   One-byte characters such as ASCII and 2-bytes characters such as kanji are all counted as one character.
  236.  
  237. Commands Available: 
  238.     print,  data size,  get, set, insert, find, replace, mark, exist, cut, copy, 
  239.     select,    speak, justify, remove break. detab, entab, toYomi, toZenkaku,
  240.     toHankaku, toUnicode, fromUnicode
  241.  
  242. Properties:
  243.     length  integer  [r/o]  
  244.         The length of a character object (in bytes)
  245.     byteoffset  integer  [r/o]  
  246.         The offset of a character object from the beginning of the document 
  247.         (the first byte has offset 1)
  248.     line number  integer  [r/o] 
  249.         The line number of a character object from the beginning of the
  250.         document (the first line has number 1)
  251.     paragraph number  integer  [r/o]  
  252.         The paragraph number of a character object from the beginning of
  253.         the document (the first paragraph has number 1)
  254.     font  international text  
  255.         The font name
  256.     fontSize  small integer  
  257.         The font size
  258.     style  text style info  
  259.         The text style
  260.     fore color  'RGB '  
  261.         The foreground (character) color
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270. "word" object
  271.  
  272.  
  273. A "word" object is a string separated by white spaces ( space codes, return codes and tab codes).  In the Japanese text, the word object may be meaningless because the spaces are not used for the word separators.
  274.  
  275.  
  276. Commands Available: 
  277.     print,  data size,  get, set, insert, find, replace, mark, exist, cut, copy, 
  278.     select, speak, justify, remove break. detab, entab, toYomi, toZenkaku,
  279.     toHankaku, toUnicode, fromUnicode
  280.  
  281. Properties:
  282.     length  integer  [r/o]  
  283.         The length of a word object (in bytes)
  284.     byteoffset  integer  [r/o]  
  285.         The offset of a word object from the beginning of the document 
  286.         (the first byte has offset 1)
  287.     line number  integer  [r/o]  
  288.         The line number of a word object from the beginning of the 
  289.         document (the first line has number 1)
  290.     paragraph number  integer  [r/o]  
  291.         The paragraph number of a word object from the beginning of 
  292.         the document  (the first paragraph has number 1)
  293.     font  international text  
  294.         The font name
  295.     fontSize  small integer  
  296.         The font size
  297.     style  text style info  
  298.         The text style 
  299.     fore color  'RGB '  
  300.         The foreground (character) color
  301.  
  302.  
  303.  
  304.  
  305. "line" object
  306.  
  307. A "line" object is a physical line of the document window.  If you change the document width from the "Document Width..." of the menu "Format", the contents of the line objects will also be changed.
  308.  
  309.  
  310.  
  311. Commands Available: 
  312.     print,  data size,  get, set, insert, find, replace, mark, exist, cut,
  313.     copy, select, speak, justify, remove break. detab, entab, toYomi,
  314.     toZenkaku, toHankaku, toUnicode, fromUnicode
  315.  
  316. Properties:
  317.     length  integer  [r/o]  
  318.         The length of a line object (in bytes)
  319.     byteoffset  integer  [r/o]  
  320.         The offset of a line object from the beginning of the document 
  321.         (the first line has number 1)
  322.     paragraph number  integer  [r/o]  
  323.         The paragraph number of a line object from the beginning of 
  324.         the document  (the first paragraph has number 1)
  325.     font  international text  
  326.         The font name
  327.     fontSize  small integer  
  328.         The font size
  329.     style  text style info  
  330.         The text style
  331.     fore color  'RGB '  
  332.         The foreground (character) color
  333.  
  334.  
  335.  
  336. "paragraph" object
  337.  
  338. A "paragraph" object is a string that is separated by return codes.
  339. Even if you change the document width from the "Document Width..." of the menu "Format", the contents of the paragraph objects will not be changed.
  340.  
  341. Commands Available: 
  342.     print,  data size,  get, set, insert, find, replace, mark, exist, cut,
  343.     copy,  select, speak, justify, remove break. detab, entab, toYomi,
  344.     toZenkaku, toHankaku, toUnicode, fromUnicode
  345.  
  346. Properties:
  347.     length  integer  [r/o]  
  348.         The length of a paragraph object (in bytes)
  349.     byteoffset  integer  [r/o]  
  350.         The offset of a paragraph object from the beginning of the document
  351.          (the first byte has offset 1)
  352.     font  international text  
  353.         The font name
  354.     fontSize  small integer  
  355.         The font size
  356.     style  text style info  
  357.         The text style 
  358.     fore color  'RGB '  
  359.         The foreground (character) color
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366. "selection" object
  367.  
  368. The selection object is the highlighted area of the document.  
  369. When the area is not selected, the cursor position is the selection object whose size is 0 byte.
  370.  
  371.  
  372. Commands Available: 
  373.     print,  data size,  get, set, insert, find, replace, mark, exist, cut,
  374.     copy,  select, speak, justify, remove break. detab, entab, toYomi,
  375.     toZenkaku, toHankaku, toUnicode, fromUnicode
  376.  
  377. Properties:
  378.     length  integer  [r/o]  
  379.         The length of a selection object (in bytes)
  380.     byteoffset  integer  [r/o]  
  381.         The offset of a selection object from the beginning of the document
  382.          (the first byte has offset 1)
  383.     line number  integer  [r/o]  
  384.         The line number of a selection from the beginning of the 
  385.         document (the first line number has number 1)
  386.     paragraph number  integer  [r/o]  
  387.         The paragraph number of a selection from the beginning of 
  388.         the document (the first paragraph has number 1)
  389.     font  international text  
  390.         The font name
  391.     fontSize  small integer  
  392.         The font size
  393.     style  text style info  
  394.         The text style
  395.     fore color  'RGB '  
  396.         The foreground (character) color
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404. Commands (Events)
  405.  
  406.  
  407.  
  408.  
  409. "run" command
  410.  
  411. run  variable OR Reference
  412.  
  413. Open the application file in the same way as when you double click on it from the Finder Desktop.
  414.  
  415.     run application "Jedit3"
  416.  
  417. Each time the "run" command is executed, the OpenApplication event will be sent to the target application to open a new window.
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425. "launch" command
  426.  
  427. launch  variable OR Reference
  428.  
  429. Launch the application file in the same way as when you double click on it from the Finder Desktop.
  430.  
  431.     launch application "Jedit3"
  432.  
  433. Unlike the "run" command, the "launch" command will not open a new window when the application is already running.
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440. "make" command
  441.  
  442. make
  443.     new  type class  -- the class of the new element
  444.     [at  location reference]  -- the location at which to insert the element
  445.     [with data  anything]  -- the initial data of the element
  446.     [with properties  record]  
  447.         -- the initial values of the properties of the new element
  448.     Result:   reference  -- reference to the new element
  449.  
  450. Open a new document or a new window.  You can not use this command to  objects other than the window and document object.
  451.  
  452. sample:
  453.     make new document
  454.     make new window
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461. "open" command
  462.  
  463. open  reference  -- the object(s) to open
  464.     [kanji type  ShiftJis/Jis/Euc/NecJis/AcosJis/CisJis/Unicode/Utf8]  
  465.         The encoding type
  466.     [lf type  mac/unix/dos]  
  467.         The line break type
  468.  
  469. The "open" command opens the document file of Jedit3.0. 
  470. The following script will open the file "MyDoc" in the "documents" folder in the "Macintosh HD":
  471.  
  472.     tell application "Jedit3"
  473.         open file "Macintosh HD:documents:MyDoc"
  474.     end tell
  475.  
  476. You can specify the type of kanji encoding in the parameter "kanji type".
  477. Available encoding types are "ShiftJis", "Jis", "Euc", "NecJis", "AcosJis", "CisJis", "Unicode", "Utf8".  You can also specify the line break type in the  parameter "lf". Available line break types are "mac"(cr), "unix"(lf), "dos"(cr+lf).
  478.     
  479.     tell application "Jedit3"
  480.         open file "Macintosh HD:documents:MyDoc" with kanji type Unicode
  481.     end tell
  482.  
  483. If you omit the encoding or the line break parameter, Jedit will judge the encoding or  line break type automatically.
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491. "print" command
  492.  
  493. print  alias  -- list of objects to print
  494.  
  495.  
  496. The "print" command will print the document of Jedit3.0 in the same way as when you select the "Print One" of the menu "File".  The "print" command can also print the objects such as file, selection, paragraph, line and so on.
  497.  
  498. print the file "MyDoc"
  499.  
  500.     tell application "Jedit3"
  501.         print file "Macintosh HD:documents:MyDoc"
  502.     end tell
  503.  
  504. print the lines from 3 to 5 of the selection of the document 1
  505.  
  506.     tell application "Jedit3"
  507.         tell document 1
  508.             print lines 3 thru 5 of selection
  509.         end tell
  510.     end tell
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519. "save" command
  520.  
  521. save  reference  -- Objects to save.
  522.     [in  alias]  
  523.         The file in which to save the object(s)
  524.     [as  same/Jedit3/TextOnly/SimpleText/ReadOnly]  
  525.         The file type of the document in which to save the data
  526.     [kanji type  ShiftJis/Jis/Euc/NecJis/AcosJis/CisJis/Unicode/Utf8]  
  527.         The type of encoding
  528.     [lf type  mac/unix/dos] 
  529.         The line break type
  530.  
  531. The "save" command will save the object that you specify in the reference.
  532. In the parameter "in", you can specify a file in which you want to save the target document in the same as you select a file after you choose the "Save As..." of the menu "File".   Omit the parameter "in" if you want to save the target document in the same way as  you save it by choosing "Save" of the menu "File".
  533.  
  534. You can also specify the file type in the parameter "as". The file types are "same" (same as the source file), "Jedit3" (Jedit3.0 normal file), "TextOnly" (Jedit3.0 file without the resource fork), "SimpleText" (SimpleText file) and "ReadOnly" (SimpleText Read-only file).
  535.  
  536. You can specify the type of encoding in the parameter "kanji type". The type of encodings are "ShiftJis", "Jis", "Euc", "NecJis", "AcosJis", "CisJis", "Unicode", "Utf8".
  537.  
  538. You can also specify the type of line break in the parameter "lf" . The type of line breaks are "mac"(cr), "unix"(lf), "dos"(cr+lf).
  539.  
  540. The following script will save the whole contents of the current document into the file "HD:documents:MyDoc" with unix type of line break and unicode type of encoding.
  541.  
  542. tell application "Jedit3"
  543.  save document 1 in file "HD:documents:MyDoc"  kanji type Unicode lf type unix
  544. end tell
  545.  
  546. The following script will save the highlighting area of the current document into the file "HD:documents:MyDoc"  with unix type of line break and unicode type of encoding.
  547.  
  548. tell application "Jedit3"
  549.  save selection of document 1 in file "HD:documents:MyDoc"  kanji type Unicode  lf type unix
  550. end tell
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559. "revert" command
  560.  
  561. revert  reference  -- object to revert
  562.  
  563. The "revert" command will let the document revert to the original state in which you last saved it. You can use this command only for document objects.
  564.  
  565. tell application "Jedit3"
  566.     revert document 1
  567. end tell
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575. "close" command
  576.  
  577. close  reference  -- the objects to close
  578.     [saving  yes/no/ask]  
  579.         Specifies whether or not changes should be saved before closing
  580.     [in  alias]  
  581.         The file in which to save the object
  582.  
  583.  
  584. The "close" command will close the document or window.  You can specify the way to save a document in the parameter "saving".  If you omit the parameter "saving", the document will be closed in the same way as you close it by choosing the "Close" of the menu "File".   In this case, if the document you close is not saved, the save dialog box asking its file name will appear. You can also assign the alias of the file in which you save with "in" parameter.
  585.  
  586. The following script will save document "MyDoc" in the file "MyFile" and then close it.
  587.  
  588. tell application "Jedit3"
  589.     close document "MyDoc"  saving yes  in  file "MyFile"
  590. end tell
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600. "quit" command
  601.  
  602. quit
  603.  
  604. The "quit" command will quit Jedit3.0 in the same way as when you quit it by choosing the "Quit" of the menu "File". 
  605. There is no parameters with this command.
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612. "data size" command
  613.  
  614. data size  reference  
  615.         The object whose data size is to be returned
  616.     Result:   integer 
  617.         The size of the object in bytes
  618.  
  619. The "data size" command will return the byte size of the specified object. In the case of the line or paragraph objects, the returned size will contain the number of the line breaks.
  620.  
  621. The following script will count the byte size of the paragraph 3 of the current document.
  622.     
  623. tell application "Jedit3"
  624.     data size of  paragraph 3 of document 1
  625. end tell
  626.  
  627. The same value will be returned if you replace the "data size" in this script with  "count bytes". 
  628.  
  629.  
  630.  
  631.  
  632.  
  633. "get" command
  634.  
  635. get  reference  
  636.         The object whose data is to be returned
  637.     Result:   anything  
  638.         The data of the object
  639.  
  640. The "get" command will return the contents or properties of the objects you specify. 
  641.  
  642. The following script will get the content of the first word of the paragraph 3 of the current document.
  643.     
  644. tell application "Jedit3"
  645.     get word 1 of paragraph 3 of document 1
  646. end tell
  647.  
  648. The following script will get the font size of the current selection
  649.  
  650. tell application "Jedit3"
  651.     get fontSize of selection of document 1
  652. end tell
  653.  
  654. The following script will copy the contents of the current document to the result variable
  655.  
  656. tell application "Jedit3"
  657.     get document 1
  658. end tell
  659.  
  660. The following script will get the style of the third word in the highlighted area of the current document.
  661.     
  662. tell application "Jedit3"
  663.     tell document 1
  664.         get style of word 3 of selection
  665.     end tell
  666. end tell
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673. "set" command
  674.  
  675. set  reference
  676.          The object to change
  677.     to  anything 
  678.         The new value
  679.  
  680.  
  681. You can use the "set" command widely to set new values, contents, properties, cursor positions, highlighted areas and so on.
  682.  
  683. The following script will replace the third word of the paragraph 3 to the string "abcd".
  684.  
  685. tell application "Jedit3"
  686.     set word 3 of paragraph 3 of document 1 to "abcd"
  687. end tell
  688.  
  689. The following script will change the font of the highlighted area to "Chicago"
  690.  
  691. tell application "Jedit3"
  692.     set font of selection of document 1 to "Chicago"
  693. end tell
  694.  
  695. The following script will set the cursor to the position before the first word of the paragraph 4
  696.  
  697. tell document 1 of application "Jedit3"
  698.     set selection to before word 1 of paragraph 4
  699. end tell
  700.  
  701.  
  702. You can use the prepositions of "before", "after" and "end" when you specify the insert position.
  703.  
  704. The following script will set the cursor to the end of the 4th paragraph (before the line break).
  705.  
  706. tell document 1 of application "Jedit3"
  707.     set selection to end of paragraph 4
  708. end tell
  709.  
  710.  
  711. The following script will move the cursor after the 4th paragraph (after the line break of the paragraph).
  712.  
  713. tell document 1 of application "Jedit3"
  714.     set selection to after paragraph 4
  715. end tell
  716.  
  717. The following script will highlight all text of the 4th paragraph.
  718.  
  719. tell document 1 of application "Jedit3"
  720.     set selection to paragraph 4
  721. end tell
  722.  
  723. The following script will select the lines from the first line to the third line.
  724.  
  725. tell document 1 of application "Jedit3"
  726.     set selection to line 1 thru 3
  727. end tell
  728.  
  729. The following script will set the style of the 3rd word 3 in the selected text to the style of "bold" and "italic".
  730.  
  731. tell document 1 of application "Jedit3"
  732.     set style of word 3 of selection to { bold, italic }
  733. end tell
  734.  
  735. The following script will set the style of the 3rd word in the selected text to the style "plain".
  736.  
  737. tell document 1 of application "Jedit3"
  738.     set style of word 3 of selection to plain
  739. end tell
  740.  
  741. The following script will set the style of the 1st line to the style "bold" when the style of the 1st line is not "bold", and vice versa. 
  742.  
  743. tell document 1 of application "Jedit3"
  744.     set style of line 1 to { bold, true }
  745. end tell
  746.  
  747.  
  748.  
  749.  
  750.  
  751. "insert" command
  752.  
  753. insert  reference
  754.         The object to be inserted
  755.     at  location reference  
  756.         The location at which to insert the object(s)
  757.  
  758. When you want to control the text editing operation of Jedit3.0, the "insert" command will be the most powerful tool. It has a wide range of uses. 
  759. You can insert or replace the various objects at any location you like.  The "insert" command will also deal with the style information in addition to the text data.
  760.  
  761. You can also use the prepositions such as "before", "beginning of", "after" and "end" when you want to specify the insert position.  Without this specification of the insert position, the object which the "at" parameter indicates will be replaced with the object which "reference" after the command "insert" indicates.
  762.  
  763. The following script will add the contents of the file "MyDoc" to the end of the current document.
  764.  
  765. tell application "Jedit3"
  766.     insert file "HD:Docs:MyDoc" at end of document 1
  767. end tell
  768.  
  769. The following script will Insert the string "abcdefg" at the beginning of the current document
  770.  
  771. tell application "Jedit3"
  772.     insert "abcdedg" at beginning of document 1
  773. end tell
  774.  
  775. The following script will replace the 3rd word with the string "abcdedg".
  776.  
  777. tell document 1 of application "Jedit3"
  778.     insert "abcdedg" at word 3
  779. end tell
  780.  
  781. The following script will add the whole contents of the current document to end of the 2nd document.
  782.  
  783. tell application "Jedit3"
  784.     insert document 1 at end of document 2
  785. end tell
  786.  
  787. The following script will add the 2nd word of the 3rd line of the current  document at the end of the 2nd document.
  788.  
  789. tell application "Jedit3"
  790.     insert word 2 of line 3 of document 1 at end of document 2
  791. end tell
  792.  
  793. The following script will add  from the 2nd to 3rd paragraphs after the last paragraph.
  794.  
  795. tell document 1 of application "Jedit3"
  796.     insert (paragraph 2 Thru 3 ) at after the last paragraph
  797. end tell
  798.     
  799. The following script will add the selected text area of the current document after the end of the 2nd document.
  800.  
  801. tell application "Jedit3"
  802.     insert the selection of document 1 at after the last paragraph of document 2
  803. end tell
  804.  
  805.  
  806.  
  807.  
  808.  
  809. "delete" command
  810.  
  811. delete  reference  
  812.     The element to delete
  813.  
  814. The "delete" command will delete the object that you specify in "reference"
  815.  
  816. The following script will delete the second line of the current document.
  817.  
  818.     tell application "Jedit3"
  819.         delete  line 2  of document 1
  820.     end tell
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827. "move" command
  828.  
  829. move  reference 
  830.         The object(s) to move
  831.     to  location reference 
  832.         The new location for the object(s)
  833.  
  834. The "move" command will move the object that you specify in "reference" to the new location. The "move" command is only valid in the same document. You can not move the object to other documents with this command.
  835.  
  836. The following script will move the selected object to the end of the 5th line. The following 2 scripts bring the same result.
  837.  
  838.     tell document 1 of application "Jedit3"
  839.         move selection to  line 5
  840.     end tell
  841. or
  842.     tell document 1 of application "Jedit3"
  843.         move selection to  end of line 5
  844.     end tell
  845.  
  846. The following script will move the 5th word of the 3rd paragraph to top of the 4th paragraph.
  847.  
  848.     tell document 1 of application "Jedit3"
  849.         move word 5 of paragraph 3 to  before paragraph  4
  850.     end tell
  851.  
  852. Move the selected object to end of the current document
  853.  
  854.     tell application "Jedit3"
  855.         move selection of document 1 to end of document 1
  856.     end tell
  857. or
  858.     tell application "Jedit3"
  859.         tell document 1
  860.             move selection to end of it
  861.         end tell
  862.     end tell
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871. "find" command
  872.  
  873. find  string 
  874.         The string to search for
  875.     in  reference  
  876.         The object reference that you search for the string
  877.     [case sensitive  boolean]  
  878.         If true, will distinguish between capital and small letters
  879.     [zenkaku sensitive  boolean]  
  880.         If true, will distinguish between hankaku and zenkaku characters
  881.     [entire word  boolean]  
  882.         If true, will search for the string as one word
  883.     [wrap around  boolean]  
  884.         If true, will continue to search from the top of the document after
  885.         it reaches the end of the document.
  886.     [start at top  boolean]  
  887.         If true, will start searching at the beginning of the document
  888.     [reverse search  boolean]  
  889.         If true, will  search in the backward direction, that is, from the
  890.         bottom to the top.
  891.     [grep  boolean]  
  892.         If true, will find in the regular expression mode 
  893.     [batch  boolean]  
  894.         If true, will find in the batch mode (find all occurrences and mark
  895.         them into the bookmark list)
  896. Result:   boolean  
  897.         If find the string, return true
  898.  
  899. The "find" command searches for a string in the object that you specify in the parameter "in".   If you specify a document object in the parameter "in", Jedit will start searching from the current cursor position of the document.  
  900. If the object at the parameter "in" is not the document, Jedit will search the range of that object.
  901.  
  902. The values of the option parameters at the "find" command are only valid in your script and will not affect the settings of the "Find Settings" dialog. If you omit the option parameters, the values defined in the "Find Settings" dialog will be used in your script.
  903.  
  904. If you set the parameter "batch" to true,  Jedit will search for all occurrences and the results will be listed in the mark list.
  905.  
  906. The following script will search the current document for the string "Jedit" as one word and without distinguishing between capital and small letters.
  907.  
  908.     tell application "Jedit3"
  909.         find  "Jedit" in  document 1 with entire word without case sensitive
  910.     end tell
  911. or
  912.     tell application "Jedit3"
  913.         tell document 1
  914.             find  "Jedit" in it with entire word without case sensitive
  915.         end tell
  916.     end tell
  917.  
  918. Note that you should  use "it" to indicate the "document 1" between the "tell document 1" statement and the"end tell" statement.
  919.  
  920. The following script will search the highlighted area of the current document for the string "Jedit" as one word and  without distinguishing between capital and small letters.
  921.  
  922.     tell application "Jedit3"
  923.         tell document 1
  924.             find  "Jedit" in selection with entire word without case sensitive
  925.         end tell
  926.     end tell
  927.  
  928. The following script will search the highlighted area of the current document for all the occurrences of the string "Jedit".
  929.  
  930.     tell application "Jedit3"
  931.         tell document 1
  932.             find  "Jedit" in selection with batch
  933.         end tell
  934.     end tell
  935.  
  936.  
  937.  
  938.  
  939.  
  940. "replace" command
  941.  
  942. replace  string 
  943.         The string to search for and to be replaced
  944.     to  string  
  945.         The replacement string
  946.     in  reference  
  947.         The object reference  that you search for the string
  948.     [case sensitive  boolean]
  949.         If true, will distinguish between capital and small letters
  950.     [zenkaku sensitive  boolean]  
  951.         If true, will distinguish between hankaku and zenkaku characters
  952.     [entire word  boolean]  
  953.         If true, will search for the string as one word
  954.     [grep  boolean] 
  955.         If true, will find in the regular expression mode 
  956.  Result:   small integer  
  957.         The number of the replacements
  958.  
  959. The "replace" command will replace strings in the object specified in the parameter "in".  You can specify the object such as document, selection, paragraph and line in the parameter "in".
  960.  
  961. The values of the option parameters in the "replace" command are only valid in your  script and will not affect the settings of the "Find Settings" dialog. 
  962. If you omit the option parameters, the values defined in the "Find Settings" dialog will be used in your script.
  963.  
  964. The following script will replace all the string "Jedit" with "Jedit3.0" in the highlighted text area of the current document.
  965.  
  966.     tell application "Jedit3"
  967.         tell document 1
  968.             replace "Jedit" to "Jedit3.0" in selection 
  969.         end tell
  970.     end tell
  971.  
  972. The following script will replace all the string "Jedit" to "Jedit3.0" in the current document.
  973.  
  974.     tell application "Jedit3"
  975.         tell document 1
  976.             replace "Jedit" to "Jedit3.0" in it
  977.         end tell
  978.     end tell
  979.  
  980.  
  981.  
  982.  
  983.  
  984. "mark" command
  985.  
  986. mark  reference  
  987.     The object to mark
  988.  
  989. The "mark" command will list the mark of location of the objects in the bookmark list.
  990.  
  991. The following script will make the mark of location of the 10th line of the current document.
  992.  
  993.     tell application "Jedit3"
  994.         tell document 1
  995.             mark line 10
  996.         end tell
  997.     end tell
  998.  
  999. The following script will make the mark of location of the highlighted area of the current document.
  1000.  
  1001.     tell application "Jedit3"
  1002.         mark selection of document 1
  1003.     end tell
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011. "count" command
  1012.  
  1013. count  reference  
  1014.         The object whose elements are to be counted
  1015.     each  type class  
  1016.         The class of the elements to be counted.
  1017.         Keyword 'each' is optional.
  1018.  Result:   integer  
  1019.         The number of elements
  1020.  
  1021. The "count" command will return the size of the object using the specified type class.
  1022.  
  1023. The following script will return the number of words of the first line of the current document.
  1024.  
  1025.     tell application "Jedit3"
  1026.         tell document 1
  1027.             count words of line 1
  1028.         end tell
  1029.     end tell
  1030. or
  1031.     tell application "Jedit3"
  1032.         tell document 1
  1033.             count line 1 each word
  1034.         end tell
  1035.     end tell
  1036.  
  1037. The following script will return the number of characters of the highlighted area of the current document.
  1038.  
  1039.     tell application "Jedit3"
  1040.         count characters of selection of document 1
  1041.     end tell
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047. "exists" command
  1048.  
  1049. exists  reference  
  1050.         The object in question
  1051.     Result:   boolean  
  1052.         True if it exists, false if not
  1053.  
  1054. The command "exists" will examine the existence of the specified object.  If the object is exists, it returns true in the "Result" variable.
  1055.  
  1056. The following script will query the existence of the 6th word in the highlighted text area of the current document.
  1057.  
  1058.     tell application "Jedit3"
  1059.         exists word 6 of selection of document 1
  1060.     end tell
  1061.     
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068. "cut" command
  1069.  
  1070. cut  reference  
  1071.     The object to be cut and brought into the clipboard
  1072.  
  1073.  
  1074. The "cut" command will delete the specified object and copy it into the clipboard.  The style information will also be copied to the clipboard.  When the object you specify is a document, the selected area of the document will be "cut" instead of the whole document.
  1075.  
  1076. Note: If Jedit is not the front application, the "cut" command will delete the object but does not copy it into the clipboard.  You should activate Jedit before you use this command.
  1077.  
  1078. The following script will cut the selected area of the current document. Both of the scripts will bring about the same result.
  1079.     
  1080.     tell application "Jedit3"
  1081.         activate
  1082.         cut document 1
  1083.     end tell
  1084. or
  1085.     tell application "Jedit3"
  1086.         activate
  1087.         cut selection of document 1
  1088.     end tell
  1089.     
  1090. The following script will cut the 4th line of the current document.
  1091.  
  1092.     tell application "Jedit3"
  1093.         activate
  1094.         cut line 4 of document 1
  1095.     end tell
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104. "copy" command
  1105.  
  1106. copy  reference  
  1107.         The source object to be copied
  1108.     [to  reference ]
  1109.         The target location
  1110.     
  1111.  
  1112. The command "copy" will copy the specified object into the target location.
  1113. If you omit the "to" parameter, the object will be copied to the clipboard. 
  1114. Note: If Jedit is not the front application, you can not copy the specified object into the clipboard. You should activate Jedit before you use this command.
  1115.  
  1116. The following script will copy the selected area of the current document to the clipboard in the same way as when you choose the "Copy" of the menu "Edit".
  1117.  
  1118.     tell application "Jedit3"
  1119.         activate
  1120.         copy document 1
  1121.     end tell
  1122.  
  1123. If you specify the location object with the parameter  "to", the location object will be replaced with the source object. 
  1124.  
  1125. The following script will replace the 3rd word  of the 5th line of the current document with the string "abcdef".
  1126.  
  1127.     tell document 1 of application "Jedit3"
  1128.         copy "abcdef"  to  word 3 of line 5
  1129.     end tell
  1130.  
  1131. The following script will bring the same result as the above script.
  1132.     
  1133.     tell document 1 of application "Jedit3"
  1134.         set (word 3 of line 5) to "abcdef"
  1135.     end tell
  1136.  
  1137. The following script will replace the highlighted area with the string "abcdef"
  1138.  
  1139.     tell document 1 of application "Jedit3"
  1140.         copy "abcdef"  to  selection
  1141.     end tell
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150. "paste" command
  1151.  
  1152. paste  reference of document object
  1153.  
  1154. The "paste" command will paste the contents of the clipboard to the highlighted area of the specified document object. You can use this command only for document objects.
  1155.  
  1156. The following script will paste the contents of the clipboard to the highlighted area of the current document.
  1157.  
  1158.     tell application "Jedit3"
  1159.         activate
  1160.         paste document 1
  1161.     end tell
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168. "select" command
  1169.  
  1170. select  reference  
  1171.     The object to select
  1172.  
  1173. The command "select" will select (highlight) the area of the specified object.
  1174.  
  1175. The following script will highlight from the 1st to 5th lines of the current document.
  1176.     
  1177.     tell document 1 of application "Jedit3"
  1178.         select  line 1 thru 5 
  1179.     end tell
  1180.  
  1181. If you want to move the cursor, use "set selection" command instead.
  1182. The following script will move the cursor to the end of the 5th line.
  1183.  
  1184.     tell document 1 of application "Jedit3"
  1185.         set selection to end of line 5
  1186.     end tell
  1187.     
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193. "undo"/"redo" command
  1194.  
  1195. undo  reference of the document
  1196. redo  reference of the document
  1197.  
  1198. The command "undo"/"redo" will undo/redo the former operation in the same way as when you choose the "Undo"/"Redo" of the menu "Edit".   You can use this command only for document objects.
  1199.  
  1200. The following script will undo the former operation done to the current document.
  1201.  
  1202.     tell application "Jedit3"
  1203.         undo document 1
  1204.     end tell
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211. "speak" command
  1212.  
  1213. speak  reference
  1214.     The object to speak
  1215.  
  1216. The command "speak" will read out the reference object according to the settings of the "Speech" panel of the "Preferences".  Speech Manager and related files must be installed to make this function work. 
  1217. (For details on speech settings, see  "Manual Chapter 3 - 3.9 Speech.")
  1218.  
  1219. The following script will read out the selected text area of the current document.
  1220.  
  1221.     tell application "Jedit3"
  1222.         tell document 1
  1223.             speak selection
  1224.         end tell
  1225.     end tell
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234. "justify" command
  1235.  
  1236. justify  reference
  1237.         The object to format
  1238.     [width  integer] 
  1239.         The line width (in bytes)
  1240.     [with prefix  string] 
  1241.         The prefix string
  1242.     [word wrap  boolean]  
  1243.         If true, the word-wrap is on
  1244.     [removing break  boolean] 
  1245.         If true, will remove line breaks and indents before formatting lines
  1246.  
  1247. The “justify” command will format lines of the reference object in the same way as when you choose the "Format Lines" of the menu "Tools".  If you specify the reference object smaller than a paragraph, the whole paragraph that contains that object will be formatted.
  1248.  
  1249. You can specify the byte width of each line in the parameter "width", the prefix string in the parameter "with prefix",  whether or not to use "word-wrap" in the  parameter "word wrap"  and wheher or not  to remove line breaks and indents in the parameter "removing break".
  1250.  
  1251. If you omit these parameters, the values defined in the "Format Lines" dialog which you can open from the "Format Setting" of the menu "Tools" will be used in your script.
  1252.  
  1253. The following script will format all lines of the current document to the width of 80 bytes with word-wrapping and without prefix.
  1254.  
  1255.     tell application "Jedit3"
  1256.         justify document 1 width 80 with prefix ""  with word wrap
  1257.     end tell
  1258.  
  1259. The following script will format from the 5th to 10th paragraphs of the current document to the width of 80 bytes with word-wrapping and adding the quote prefix ">".
  1260.  
  1261.     tell application "Jedit3"
  1262.         tell document 1
  1263.             justify  paragraph 5 thru 10  width 80 with prefix ">" 
  1264.                                                          with  word wrap
  1265.         end tell
  1266.     end tell
  1267.     
  1268. The following script will remove line breaks and indents from the selected text area and then format it to the width of 80 bytes with word-wrapping and adding the quote prefix ">".
  1269.  
  1270.     tell application "Jedit3"
  1271.         tell document 1
  1272.             justify  selection  width 80 with prefix ">"  
  1273.                                     with word wrap with removing break
  1274.         end tell
  1275.     end tell
  1276.     
  1277.  
  1278.  
  1279.  
  1280. "remove break" command
  1281.  
  1282. remove break  reference
  1283.         The object to remove breaks
  1284.  
  1285. The command "remove break" will remove line breaks and indents of the specified object.
  1286.  
  1287. The following script will remove all line breaks and indents from the current document.
  1288.  
  1289.     tell application "Jedit3"
  1290.         remove break document 1
  1291.     end tell
  1292.         
  1293. The following script will remove line breaks and indents from the current selected text area.
  1294.  
  1295.     tell application "Jedit3"
  1296.         remove break selection of document 2
  1297.     end tell
  1298.  
  1299. The following script will remove line breaks and indents from the text area that extends from the 1st to 10th paragraph of the current document.
  1300.  
  1301.     tell document 1 of application "Jedit3"
  1302.         remove break paragraph 1 thru 10
  1303.     end tell
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312. "detab" command
  1313.  
  1314. detab  reference
  1315.     The object to detab
  1316.  
  1317. The "detab" command will replace tab codes with corresponding space codes in the specified object.
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326. "entab" command
  1327.  
  1328. entab  reference
  1329.     The object to entab
  1330.  
  1331. The "entab" command will replace space codes with corresponding tab codes in the specified object.
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340. "convert kanji space to ascii" command
  1341.  
  1342. convert kanji space to ascii  reference
  1343.     The object to convert
  1344.  
  1345. The "convert kanji space to ascii" command will replace 2-bytes kanji space codes to corresponding ASCII space codes in the specified object.
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353. "toYomi" command
  1354.  
  1355. toYomi  reference
  1356.     The object to convert
  1357.     
  1358. The "toYomi" command will convert the Japanese kanji strings to the hiraganas. Language Analysis Manager (supported in MacOS8.5J or higher) must be installed to make this function work. 
  1359.  
  1360. The following script will convert all kanji characters to  the hiragana characters in the selected text area of the current document .
  1361.  
  1362.     tell application "Jedit3"
  1363.         tell document 1
  1364.             toYomi selection
  1365.         end tell
  1366.     end tell
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375. "toZenkaku" command
  1376.  
  1377. toZenkaku reference
  1378.             the object to convert
  1379.         [with cnvFlag  string]  
  1380.             16 digit Hexadecimal string from the Conversion Setting Dialog
  1381.  
  1382. The "toZenkaku" command will convert the hanakaku characters into the zenkaku characters in the specified object.   You can specify the details of the conversion in the "Hankaku to Zenkaku" dialog from the menu "Tools".  You can also specify the details of the conversion in the parameter "with cnvFlag".   The "cnvFlag" is a 16-digits hexadecimal string which you can copy from the "Hankaku to ZenKau" dialog.
  1383. (For details of the "cnvFlag", see "Chapter 7, 7-8 Conversion Menus".)
  1384.  
  1385. The following script will convert the hankaku numeric characters of the selected area to the zenkaku characters.
  1386.  
  1387.     tell application "Jedit3"
  1388.         tell document 1
  1389.             toZenkaku selection with cnvFlag "4000000000000000"
  1390.         end tell
  1391.     end tell
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400. "toHankaku" command
  1401.  
  1402. toHankaku reference
  1403.             The object to convert
  1404.         [with cnvFlag  string]  
  1405.             16 digit Hexadecimal string from the Conversion Setting Dialog
  1406.  
  1407. The "toHankaku" command will convert the Zenakaku characters into the hankaku characters in the specified object.  You can specify the details of the conversion by the "Zenkaku to Hankaku" dialog from the menu "Tools".  You can also specify the details of the conversion in the parameter "with cnvFlag".   The "cnvFlag" is a 16-digits hexadecimal string which you can copy from the  "Zenkaku to Hankaku" dialog.
  1408. (For details of the "cnvFlag", see "Chapter 7, 7-8 Conversion Menus".)
  1409.  
  1410. The following script will convert the Zenkaku numeric characters of the selected area to the hankaku characters in the current document.
  1411.  
  1412.     tell application "Jedit3"
  1413.         tell document 1
  1414.             toHankaku selection with cnvFlag "4000000000000000"
  1415.         end tell
  1416.     end tell
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424. "convert kana to zenkaku" command
  1425.  
  1426. convert kana to zenkaku  reference
  1427.  
  1428. The "convert kana to zenkaku" command will convert the hankaku kana characters of the reference into the zenkaku kana characters in the specified object.   This command will bring the same result as the "toZenkaku" command with the cnvFlag of "1000003E00000000".
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436. "convert ascii to hankaku" command
  1437.  
  1438. convert ascii to hankaku reference
  1439.  
  1440. The "convert ascii to hankaku" command will convert the zenkaku ASCII characters into the hankaku ASCII characters in the specified object.   This command will bring the same result as the "toHankaku" command with the cnvFlag of "E0000001FFFFFFFE".
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447. "remove tailing space" command
  1448.  
  1449. remove tailing space  reference
  1450.  
  1451.  
  1452. The "remove tailing space" command will remove the unnecessary tailing spaces at the end of paragraphs in the reference.
  1453.  
  1454. The following script will remove the tailing spaces of the selected text area.
  1455.  
  1456.     tell application "Jedit3"
  1457.         tell document 1
  1458.             remove tailing space selection
  1459.         tell end
  1460.     tell end
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468. "toUnicode" command
  1469.  
  1470. toUnicode  reference
  1471.  
  1472. The "toUnicode" command will convert the reference object into the Unicode hexadecimal expressions (\uxxxx).
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482. "fromUnicode" command
  1483.  
  1484. fromUnicode  reference
  1485.  
  1486. The "fromUnicode" command will let the Unicode hexadecimal expressions (\uxxxx) revert to the normal characters in the specified object.
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499. "OpenURL" command
  1500.  
  1501. OpenURL  reference  
  1502.         URL string or document
  1503.     Result:   boolean
  1504.         will return true if the web page of the specified URL is opened     
  1505.         successfully,
  1506.  
  1507. The "OpenURL" command will start the default browser and open the web page of the specified URL.  "Internet Config" must be installed to make this function work.  The protocols of "http", "ftp", "mailto" and "file" are supported.
  1508.  
  1509. The following script will open the Matsumoto's web page "http://www.matsumoto.co.jp" with your default browser.
  1510.  
  1511.     tell application "Jedit3"
  1512.         OpenURL "http://www.matsumoto.co.jp"
  1513.     end tell
  1514.  
  1515. The following script will open the URL of the cursor position of the current document with your default browser.  If the cursor is located among the URL string, you don't need to select the whole URL string to make this script work.
  1516.  
  1517.  
  1518.     tell application "Jedit3"
  1519.         OpenURL  document 1
  1520.     end tell
  1521.     
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528. "OpenDict" command
  1529.  
  1530. OpenDict  reference 
  1531.         The word or the document to look up
  1532.     Result:   boolean
  1533.           will return true if the dictionary is opened successfully.
  1534.  
  1535. The "OpenDict" command will look up the specified word in the dictionary that is registered in the "Word Service" of the menu "Tools".  If more than one dictionaries are registered in the "Word Service" menu, the first dictionary in that menu will be used.
  1536.  
  1537. The following script will look up the word "meditation" in the dictionary.
  1538.  
  1539.     tell application "Jedit3"
  1540.         OpenDict "meditation"
  1541.     end tell
  1542.  
  1543. The following script will look up the selected word of the current document in the dictionary.
  1544.         
  1545.     tell application "Jedit3"
  1546.         OpenDict  document 1
  1547.     end tell
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558. "OpenChecker" command
  1559.  
  1560. OpenChecker  reference 
  1561.         The object to check
  1562.     with menu  international text  
  1563.         The name of the checker which appears in the "Word Services" menu.
  1564. Result:   boolean
  1565.         If the checker is opened successfully, true will be returned
  1566.  
  1567. The "OpenChecker" command will check the spellings of the specified object using the spell checker of the parameter "with menu".
  1568.  
  1569. The following script will check the correctness of HTML of the current document using "JChecker" whose name is "Check HTML" in the "Word Service" menu.
  1570.  
  1571.     tell application "Jedit3"
  1572.         OpenChecker  document 1 with menu "Check HTML"
  1573.     end tell
  1574.  
  1575. You can use this command not only for checkers but also for dictionaries.
  1576. The following script will look up the selected word of the current document using the dictionary application whose name is "Jamming 2.8.1 PPC" in the "Word Service" menu.
  1577.  
  1578.     tell application "Jedit3"
  1579.         OpenChecker  document 1 with menu "Jamming 2.8.1 PPC"
  1580.     end tell
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591. "preDialog"/"postDialog" command
  1592.  
  1593. preDialog 
  1594. postDialog
  1595.  
  1596. You should use these commands before and after the statement which opens dialog boxes in your script.  Otherwise, Jedit's selection control of windows will possibly be in disorder when your script ends.
  1597.  
  1598. Following example is using preDialog and postDialog commands before and after the "choose folder" command.
  1599.  
  1600.     preDialog
  1601.     try
  1602.         copy (choose folder with prompt "Where is the folder?") to checkFolder
  1603.     on error
  1604.         postDialog
  1605.         error number -128
  1606.     end try
  1607.     postDialog
  1608.  
  1609. Note that in the above example the "postDialog" command is used between "on error" and "error number -128" statements as well as after the "end try" statement .
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618. "suspend" command
  1619.  
  1620. suspend
  1621.  
  1622. When you open some other application from your script, it sometimes happens that after this script ends you cannot use the TSM inline conversion mode with the document of Jedit.  To avoid this trouble, we recommend that you use the "suspend" command before the statement of your script which will open other application.
  1623.  
  1624. In the following script, the "suspend" command is used before the statement which will open the "Internet Explorer".
  1625.  
  1626.     tell application "Jedit3"
  1627.         activate
  1628.         save document 1
  1629.         copy fileSpec of document 1 to FileName
  1630.         suspend
  1631.         tell application "Internet Explorer 4.5"
  1632.             Activate
  1633.             open FileName
  1634.         end tell
  1635.     end tell
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644. "updateMacroMenu" command
  1645.  
  1646. updateMacroMenu
  1647.  
  1648. The "updateMacroMenu" command will update the "Macro" menu after you add or remove macro script files in the "Macro Menu Items" folder.
  1649.  
  1650. The following example script will replace all macro menu items with new macro menu items using the contents of the folder "another Macro Menu Items".
  1651.  
  1652.     tell application "Jedit3"
  1653.         get Jedit folder
  1654.         copy (result as text) to temp
  1655.         suspend
  1656.         tell application "Finder"
  1657.             activate
  1658.             select folder "Macro Menu Items" of folder temp
  1659.             set name of selection to "Old Macro Menu Items"
  1660.             select folder "another Macro Menu Items" of folder temp
  1661.             set name of selection to "Macro Menu Items"
  1662.             select folder "Old Macro Menu Items" of folder temp
  1663.             set name of selection to "another Macro Menu Items"
  1664.         end tell
  1665.         updateMacroMenu
  1666.     end tell
  1667.     
  1668.  
  1669.  
  1670.